﻿<!-- #layout name=noMenu --sideType='domain'-->

<div class="page-header">
    <h1 class="title">Domain management</h1>
</div>
<div class="navbar navbar-default">
    <div class="container-fluid">

        <a class="btn green navbar-btn" data-bind="click: showDialog">
            <span>Add a domain</span>
            <i class="fa fa-plus"></i>
        </a>

        <a k-if="kooboosetting.IsLocal = false" class="btn green navbar-btn" data-bind="attr: {href: registerPageUrl}">Register a domain<i class="fa fa-plus"></i>
        </a>

        <a data-bind="visible: showDeleteBtn, click: onDelete" class="btn red navbar-btn">Delete</a>
    </div>
</div>
<div data-bind="component: { name: 'kb-table', params: tableData }"></div>

<div class="modal fade" data-bind="modal: dialogShow" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog">
        <form>
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-bind="click: cancelDialog">
                        <i class="fa fa-close"></i>
                    </button>
                    <h4 class="modal-title">New local domain</h4>
                </div>
                <div class="modal-body">
                    <div class="note note-info" k-if="kooboosetting.IsLocal = true">
                        <h4 class="title">You are running in local mode</h4>
                        <p>You need to configure DNS records. For Windows desktop users, a mapping of your website domain to 127.0.0.1 may be created on your system host file</p>
                    </div>
                    <div class="note note-info" k-if="kooboosetting.IsLocal = false">
                        <h4 class="title">Adding a domain to your account</h4>
                        <p>Use below DNS server, all DNS records will be created automatically for you.</p>
                        <dl data-bind="foreach: dnsServers">
                            <!--<dt data-bind="text: 'DNS ' + ($index() + 1)"></dt>-->
                            <dd data-bind="text: $data"></dd>
                        </dl>
                        <p>Or create your domain  wildcard CNAME record to below domain. To use email service, also configure the Mx record to below domain.</p>
                        <p data-bind="text: cName"></p> 
                        <p>Or create your domain wildcard A record to below IP address. This is not recommeneded because we may change our IP</p>
                        <p data-bind="text: providedIP"></p>
                    </div>

                    <div class="form-horizontal">
                        <div class="form-group">
                            <label class="col-md-2 control-label" for="DomainName">Domain</label>
                            <div class="col-md-10">
                                <input data-bind="textInput: domain, error: domain" class="form-control" placeholder="kooboolocal.com" type="text">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button data-bind="click: save" class="btn green">Add</button>
                    <button data-bind="click: cancelDialog" class="btn gray">Cancel</button>
                </div>
            </div>
        </form>
    </div>
</div>

<script>
    (function() {
        Kooboo.loadJS([
            "/_Admin/Scripts/components/kbTable.js",
            "/_Admin/Scripts/tableModel.js"
        ])
    })()
</script>
<script src="/_Admin/View/Domains.js"></script>